//
//  HELCompulsoryM.m
//  sanda
//
//  Created by 陈武琦 on 16/7/14.
//  Copyright © 2016年 陈武琦. All rights reserved.
//

#import "HELCompulsoryM.h"

@implementation HELCompulsoryM

+ (instancetype)realmFromCourse:(HELCourseDetailModel *)course{
    HELCompulsoryM *relmCourse =[HELCompulsoryM new];
    //    @property NSString *attachUrl;
    //    @property NSInteger id;
    //    @property NSString *tblStudyDataId;
    //    @property NSString *name;
    //    @property NSString *viewNum;
    //    @property NSString *commentNum;
    //    @property NSString *scoreAvg;
    //    @property NSString *progress;
    //    @property HELPicRLM *attachUrlMap;
    relmCourse.attachUrl =course.attachUrl;
    relmCourse.id = [course.id integerValue];
    relmCourse.pdfName = course.pdfName;
    relmCourse.name = course.name;
    relmCourse.viewNum = course.viewNum;
    //    relmCourse.commentNum =course
    relmCourse.scoreAvg = course.scoreAvg;
    relmCourse.progress = course.progress;
    HELPicRLM *picMap = [HELPicRLM new];
    picMap.mid = course.attachUrlShowMap.mid;
    picMap.mini = course.attachUrlShowMap.mini;
    picMap.src = course.attachUrlShowMap.src;
    relmCourse.attachUrlMap = picMap;
    relmCourse.userId =HEL_USERID;
    return relmCourse;

   
}
- (void)updateWithCourse:(HELCourseDetailModel *)course{
    self.attachUrl =course.attachUrl;
    self.id = [course.id integerValue];
    self.pdfName = course.pdfName;
    self.name = course.name;
    self.viewNum = course.viewNum;
    //    relmCourse.commentNum =course
    self.scoreAvg = course.scoreAvg;
    self.progress = course.progress;
    HELPicRLM *picMap = [HELPicRLM new];
    picMap.mid = course.attachUrlShowMap.mid;
    picMap.mini = course.attachUrlShowMap.mini;
    picMap.src = course.attachUrlShowMap.src;
    self.attachUrlMap = picMap;
    self.userId =HEL_USERID;
}
@end
